package br.ufmg.ubicomp.droidguide.context;

import android.app.Activity;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

public class MyLocationListener implements LocationListener {

	private Activity activity;

	public MyLocationListener(Activity activity) {
		super();
		this.activity = activity;
	}

	public void onLocationChanged(Location loc) {
		// Called when the location has changed.
		Log.d("Location", "===>>> onLocationChanged");
		if (loc != null) {
			Toast.makeText(
					activity.getBaseContext(),
					"Location changed : Lat: " + loc.getLatitude()
							+ " Lng: " + loc.getLongitude(),
					Toast.LENGTH_SHORT).show();

		}
	}

	public void onProviderDisabled(String provider) {
		// Called when the provider is disabled by the user.
		Log.d("Location",
				"===>>> onProviderDisabled PROVIDER:"
						+ provider);
		// Mapa.ehPraAtualizar = false;
	}

	public void onProviderEnabled(String provider) {
		Log.d("Location",
				"===>>> onProviderEnabled PROVIDER:"
						+ provider);
		// Called when the provider is enabled by the user.
	}

	public void onStatusChanged(String provider, int status, Bundle extras) {
		Log.d("Location",
				"===>>> onStatusChanged STATUS:"
						+ status + " PROVIDER:" + provider);
		// Called when the provider status changes.
	}
}
